<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('sys_operation_logs', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('user_id')->nullable()->comment('用户id');
            $table->string('path')->nullable()->comment('请求路径');
            $table->string('url', 500)->nullable()->comment('请求路由');
            $table->string('method', 20)->nullable()->comment('请求方法');
            $table->string('ip', 25)->nullable()->comment('IP');
            $table->string('ua')->nullable()->comment('用户代理');
            $table->text('input')->nullable()->comment('请求参数');
            $table->text('file')->nullable()->comment('上传文件名');
            $table->float('time', 13)->nullable()->comment('响应时间ms');
            $table->string('mem', 20)->nullable()->comment('占用内存');
            $table->text('response')->nullable()->comment('返回数据');
            $table->dateTime('create_time')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('sys_operation_logs');
    }
};
